//   "flag_id": 4,
//   "description": "asdfasdfasdfasdf",
//   "mode": 1,
//   "period": "2025/2/18 22:14:56",
//   "start": "2025/1/18 22:14:56",
//   "over": false,
//   "checktime": null,
//   "email": "753280878@qq.com",

import { AddFlagParams } from "@/type/flag"
import { isCodeMessage } from "../config"

/**
 * @author: 小佘佘🦀
 * @description: 登录接口
 * @param {Flag} flag
 * */
export const createFlag = async (flag: AddFlagParams) => {

    const response = await fetch(`/api-backend/api/flag/add`, {
        method: "POST",
        headers: {
            "content-type": "application/json",
        },
        // mode: "no-cors",
        body: JSON.stringify(flag),
        redirect: "manual"
    })

    return isCodeMessage(response)
}